
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<% String context = request.getContextPath(); %>
<html>
<head>
    <title>审批任务</title>
    <link rel="stylesheet" href="<%=context %>/Source/lib/layui/css/layui.css">
    <style type="text/css">
        .information{
            display: none;
        }
    </style>

</head>
<body style="margin: 0;">
        <!-- 2018/5/25新增： 对外提供服务时，能够将 流程审核人的id传进来 -->
        <input id="approverId" type="hidden" value="${approverId}" />
        <input id="executorName" type="hidden" value="${executorName}" />
        <table class="layui-table">
            <colgroup>
                <col>
                <col>
                <col>
                <col>
            </colgroup>
            <thead>
            <tr>
                <th colspan="4">业务摘要信息</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>流程发起人：</td>
                <td id="startUser" ></td>
                <td>工作说明：</td>
                <td id="flowRemark" ></td>
            </tr>
            </tbody>
            <thead class="information">
            <tr>
                <th colspan="4">上一步处理信息</th>
            </tr>
            </thead>
            <tbody class="information" >
            <tr >
                <td>任务名称：</td>
                <td id="taskName"></td>
                <td>完成时间：</td>
                <td id="lastCompleteTime"></td>
            </tr>
            <tr>
                <td>完成人：</td>
                <td id="completeUser"></td>
                <td>完成意见：</td>
                <td id="completeRemark"></td>
            </tr>
            </tbody>
            <tbody  class="layui-form">
            <tr>
                <td>是否同意：</td>
                <td colspan="3">
                    <div id="radio" class="layui-input-inline">
                        <input type="radio" name="radio" value="1" title="同意" checked>
                        <input type="radio" name="radio" value="0" title="不同意">
                    </div>
                </td>
            </tr>
            <tr>
                <td>处理意见：</td>
                <td colspan="3">
                    <textarea id="dealSuggestion" name="" required lay-verify="required" placeholder="请输入" class="layui-textarea"></textarea>
                </td>
            </tr>
            </tbody>
        </table>
<input type="hidden" id="taskId" value="">
<input type="hidden" id="taskNodeCode" value="">
<input type="hidden" id="otherTaskIds" value="">
</body>
<script src="<%=context %>/gooflow/jquery.min.js"></script>
<script src="<%=context %>/Source/lib/layui/layui.js"></script>
<%--<script src="<%=context %>/Source/lib/ligerUI/js/ligerui.all.js"></script>--%>
    <script type="text/javascript">
    var path = '<%=context %>';
    var _path = path + "/flow/task";
    var taskModel = ${taskModel};
    var approverId = $('#approverId').val();
    var executorName = $('#executorName').val()

    var beforTaskModel = ${beforTaskModel};
        function complete(loc) {
        	var completeTaskRequest = {
        			taskId:$("#taskId").val(),
        			taskNodeCode:$("#taskNodeCode").val(),
        			otherTaskIds:$("#otherTaskIds").val(),
        			dealSuggestion:$("#dealSuggestion").val().trim(),
        			isAgree:$("input[name='radio']:checked").val()
        	};
        	// console.log(completeTaskRequest)
            $.ajax({
                url: _path + "/completeTask" +"?approverId="+approverId +"&executorName=" + executorName,
                type: "POST",
                //contentType: 'application/json;charset=utf-8', //设置请求头信息
                dataType: "json",
                data: completeTaskRequest,
                success: function (result) {
                    loc.reload(true);
                }
            });
            
        }
        
        $(function(){
        	
        	console.log(taskModel);
        	console.log(beforTaskModel);
        	$("#startUser").text(taskModel.startUser);
        	$("#flowRemark").text(taskModel.flowRemark);
        	$("#taskId").val(taskModel.taskId);
        	//$("#taskNodeCode").val();
        	//$("#otherTaskIds").val();
        	if("流程启动"==beforTaskModel.taskName){
        		$("#no_information").show();
        	}else{
        		$("#taskName").text(beforTaskModel.taskName);
            	$("#lastCompleteTime").text(beforTaskModel.lastCompleteTime);
            	$("#completeRemark").text(beforTaskModel.completeRemark);
            	$("#completeUser").text(beforTaskModel.completeUser);
        		$(".information").show();
        	}
        	
        	
        	
        	
            // var dataGrid = [
            //     { id: 1, checked: 'checked' , name: '同意', value: '1' },
            //     { id: 2, name: '不同意', value: '0' }
            //     ];
            // $("#radio").ligerRadioList({
            //     data: dataGrid,
            //     valueField: 'value',
            //     textField: 'name',
            //     valueFieldID: 'isAgree',
            //     value: '1',
            // });
        });

    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });
    </script>
</html>

